From: Jasper St. Pierre Date: Fri, 1 Mar 2013 20:29:42 +0000 (-0500) Subject: layout: Debounce triggering barriers X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4555 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0cc161525254b367fae5e1abc466e90414d938e8;p=gnome-shell.git layout: Debounce triggering barriers Ensure that the pointer leaves the barrier before we trigger again. For the message tray case, this doesn't matter much, as the trigger won't have any effect after the grab is taken, but in the overview HotCorner case, this ensures that we don't trigger the overview transition many times simply by holding pressure against the hot corner, which is easy to do accidentally. --- diff --git a/js/ui/layout.js b/js/ui/layout.js index bcc0dda6e..e2691c0f4 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -1264,6 +1264,7 @@ const PressureBarrier = new Lang.Class({ this._timeout = timeout; this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL; + this._isTriggered = false; this._reset(); this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit)); @@ -1322,14 +1323,21 @@ const PressureBarrier = new Lang.Class({ _onBarrierLeft: function(barrier, event) { this._reset(); + this._isTriggered = false; }, _trigger: function() { + this._isTriggered = true; this.emit('trigger'); this._reset(); }, _onBarrierHit: function(barrier, event) { + // If we've triggered the barrier, wait until the pointer has the + // left the barrier hitbox until we trigger it again. + if (this._isTriggered) + return; + // Throw out all events where the pointer was grabbed by another // client, as the client that grabbed the pointer expects to have // complete control over it